<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsCollectTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_collect', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->timestamps();

            $table->integer('goods_id')->unsigned()->comment('商品id');

            $table->integer('user_id')->unsigned()->comment('用户id');


            $table->unique(['goods_id','user_id']);
        });
        DB::statement("ALTER TABLE `goods_collect` COMMENT='商品收藏表'");//表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_collect');
    }
}
